package weixinkeji.dev.dc.base.refectory.h;

import MyUI.ligerUI.bean.LigerUIOrderBy;
import MyUI.ligerUI.service.LigeruiService;
import sys.wx.c.ATR;
import sys.wx.ann.hm.H;
import sys.wx.ann.hm.M;
import sys.wx.c.components.check.bean.CheckData;
import sys.wx.c.components.cv.CV;
import sys.wx.m.db.SQL.mysql.common.TJF;
import sys.wx.m.db.SQL.mysql.common.orderby.OrderBy;
import sys.wx.m.db.SQL.mysql.common.where.Where;
import sys.wx.m.db.dao.mysql.Dao;
import weixinkeji.dev.dc.base.refectory.bean.Refectory;

/**
 *
 * @author IK
 */
@H("weixinkeji/dev/dc/base/refectory/s")
public class RefectorySManager {

    @M("/manager")//weixinkeji/dev/dc/base/refectory/s/manager.imy
    public static String s(ATR a) { //weixinkeji/dev/dc/base/unit/s/manager.imy
//        LigeruiServies ls=new LigeruiServices();
        LigerUIOrderBy page = LigeruiService.getOrderBy(a.request);

        a.printOne(LigeruiService.getGRID(
                Dao.selectVastOrderBy(
                        Refectory.class,
                        Where.putIN(Where.TJ_IGNORE_EMPTY_NULL, Refectory.class, "", "flid", CV.toSQLStringValue(CV.getParameter(a.request, "flid", CheckData.IDS))),
                        (null == page.sortname ? "" : getOrderBy(page)))
        ));
        return null;
    }

    private static String getOrderBy(LigerUIOrderBy page) {
        OrderBy ob = TJF.getOrderBy(null);
        ob.put(page.sortname).putASC_DESC(page.sortorder);
        return ob.toSql();
    }

}
